home *** CD-ROM | disk | FTP | other *** search
/ Delphi Informant Complete 1995 - 2000 / Delphi Informant Complete 1995 to 2000.iso / Delphi Informant Magazine Complete Works SOURCE CODE 1995.rar / 1995 / OCT / CC9510 / main.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-21  |  1KB  |  63 lines

  1. unit Main;
  2.  
  3. { Program copyright (c) 1995 by Charles Calvert }
  4. { Project Name: TESTSTR }
  5.  
  6. { This program demonstrates some routines from
  7.   the STRBOX unit that can be used when you want
  8.   to manipulate strings. The STRBOX unit is stored
  9.   in the UTILS subdirectory, which should be on
  10.   your Library Path. }
  11.  
  12. interface
  13.  
  14. uses
  15.   WinTypes, WinProcs, Classes,
  16.   Graphics, StdCtrls,  Controls,
  17.   Forms;
  18.  
  19. type
  20.   TForm1 = class(TForm)
  21.     BParse: TButton;
  22.     Edit1: TEdit;
  23.     ListBox1: TListBox;
  24.     procedure BParseClick(Sender: TObject);
  25.     procedure FormCreate(Sender: TObject);
  26.   private
  27.     TestStr: string;
  28.   end;
  29.  
  30. var
  31.   Form1: TForm1;
  32.  
  33. implementation
  34.  
  35. uses
  36.   StrBox;
  37.  
  38. {$R *.DFM}
  39.  
  40. procedure TForm1.BParseClick(Sender: TObject);
  41. var
  42.   S: string;
  43. begin
  44.   ListBox1.Clear;
  45.   TestStr := Edit1.Text;
  46.   repeat
  47.     TestStr := StripFrontChars(TestStr, #32);
  48.     S := RemoveFirstWord(TestStr);
  49.     if S <> '' then
  50.       ListBox1.Items.Add(S);
  51.   until S = '';
  52.   if TestStr <> #32 then
  53.     ListBox1.Items.Add(TestStr);
  54. end;
  55.  
  56. procedure TForm1.FormCreate(Sender: TObject);
  57. begin
  58.   TestStr := 'In the long sleepless watches of the night';
  59.   Edit1.Text := TestStr;
  60. end;
  61.  
  62. end.
  63.